package com.juyu.miliao.api.dao.mysql;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.juyu.miliao.api.domain.RedPacket;

@Repository
public class RedPacketDao {
	@Autowired
	private SqlSession sqlSession;
	
	public List<RedPacket> getRedPacketById(@Param("userId")int userId,@Param("startNum") int startNum, @Param("pageSize") int pageSize){
		Map<String, Object> params = new HashMap<>();
		params.put("userId", userId);
		params.put("startNum", startNum);
		params.put("pageSize", pageSize);
		return sqlSession.selectList("getRedPacketById", params);
	}

	public int insertRedPacket(RedPacket entity){
		return sqlSession.insert("insertRedPacket", entity);
	}

}
